<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="live.cz.entity.Order"%>
<%@page import="live.common.Format"%>
<%@page import="live.cz.dao.OrderPay"%>
<%@page import="live.common.PostParam"%>
<%@page import="live.pay.SignUtil"%>
<%@page import="live.api.impl.PaySendReqRes"%>
<%@page import="live.common.GetSequence"%>
<%
	Order order = (Order)request.getAttribute("item");
	OrderPay op = new OrderPay();	
	String req_trans_tm=Format.getInstance().dateFormatString(new Date(), "yyyyMMddHHmmss");
	String req_trans_seq=GetSequence.returnSeqNum();
	String amt = String.valueOf((int)(order.getSalePrice()*100));
	String desc=op.returnOrderDesc(order);
	Map map = new TreeMap();
	map.put("service_id","110003");
	map.put("req_org_cd","123456");
	map.put("req_trans_tm",req_trans_tm);
	map.put("req_trans_seq",req_trans_seq);
	map.put("order_id",order.getOrderid());
	map.put("seller_id","12345");
	map.put("sub_order_flag","N");
	map.put("sub_order_num","0");
	map.put("order_desc",desc);
	map.put("tot_trans_amt",amt);
	map.put("buyer_id","12345678");
	map.put("valid_date","0");
	map.put("notify_url",PostParam.NOTIFY.toString());
	map.put("return_url","");
	String sign=SignUtil.sign(map,PostParam.PAYKEY.toString());
	map.put("sign",sign);
	map.put("sign_type","MD5");
	PaySendReqRes.insertSendRequest(map);
	
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
  </head>
  
  <body>
    <form action="<%=PostParam.PAY_API.toString() %>" method="post">
    	<input name="service_id" value="110003"/>
    	<input name="req_org_cd" value="123456"/>
    	<input name="req_trans_tm" value="<%=req_trans_tm %>"/>
    	<input name="req_trans_seq" value="<%=req_trans_seq%>"/>
    	<input name="order_id" value="<%=order.getOrderid() %>"/>
    	<input name="seller_id" value="12345"/>
    	<input name="sub_order_flag" value="N"/>
    	<input name="sub_order_num" value="0"/>
    	<%-- <input name="sub_order_dtl" value=""/>--%>
    	<input name="order_desc" value="<%=desc%>"/>
    	<input name="tot_trans_amt" value="<%=amt%>"/>
    	<input name="buyer_id" value="12345678"/>
    	<input name="valid_date" value="0"/>
    	<input name="notify_url" value="<%=PostParam.NOTIFY.toString() %>"/>
    	<input name="return_url" value=""/>
    	<input name="sign" value="<%=sign %>"/>
    	<input name="sign_type" value="MD5"/>
    </form>
    <script type="text/javascript">
    document.forms[0].submit();
    </script>
  </body>
</html>
